import { message } from "antd";

import { setMessageApi } from '../../utils/message';

// 这个组件仅用于创建消息实例并提供上下文
const GlobalMessage = () => {
    const [messageApi, contextHolder] = message.useMessage();

    // 将实例保存到全局变量
    setMessageApi(messageApi);

    return contextHolder;
};

export default GlobalMessage;